package com.sbmoon.util;

import java.util.*;
import java.text.SimpleDateFormat;
import java.text.ParseException;

public class DateUtil {

	public static Date getNowDate() {

		return new Date(System.currentTimeMillis());

	}

	public static String toSqlStyleValue(Date date) {

		//  TO_DATE('2010-03-04 19:22:15', 'YYYY--MM-DD HH24:MI:SS')
		return "TO_DATE('" +  df.format((date)) + "', 'YYYY--MM-DD HH24:MI:SS')";
	}

	private static final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	//private static final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

	public static void main( String [] args ) throws Exception {
		String aaa = toSqlStyleValue( new Date() );
		System.out.println( aaa );
	}

}
